package com.zjsd.sqeybusiness.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Lyhfinfo;
import com.zjsd.sqeybusiness.service.ILyhfinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 留言回复信息Controller
 *
 * @author Zheng
 * @date 2021-03-23
 */
@RestController
@RequestMapping("/jph/lyhfinfo")
public class LyhfinfoController extends BaseController
{
    @Autowired
    private ILyhfinfoService lyhfinfoService;

    /**
     * 查询留言回复信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Lyhfinfo lyhfinfo)
    {
        startPage();
        List<Lyhfinfo> list = lyhfinfoService.selectLyhfinfoList(lyhfinfo);
        return getDataTable(list);
    }

    /**
     * 导出留言回复信息列表
     */
    //@Log(title = "留言回复信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Lyhfinfo lyhfinfo)
    {
        List<Lyhfinfo> list = lyhfinfoService.selectLyhfinfoList(lyhfinfo);
        ExcelUtil<Lyhfinfo> util = new ExcelUtil<Lyhfinfo>(Lyhfinfo.class);
        return util.exportExcel(list, "lyhfinfo");
    }

    /**
     * 获取留言回复信息详细信息
     */
    @GetMapping(value = "/{lyhfid}")
    public AjaxResult getInfo(@PathVariable("lyhfid") Long lyhfid)
    {
        return AjaxResult.success(lyhfinfoService.selectLyhfinfoById(lyhfid));
    }

    /**
     * 新增留言回复信息
     */
    //@Log(title = "留言回复信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Lyhfinfo lyhfinfo)
    {
        return toAjax(lyhfinfoService.insertLyhfinfo(lyhfinfo));
    }

    /**
     * 修改留言回复信息
     */
    //@Log(title = "留言回复信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Lyhfinfo lyhfinfo)
    {
        return toAjax(lyhfinfoService.updateLyhfinfo(lyhfinfo));
    }

    /**
     * 删除留言回复信息
     */
    //@Log(title = "留言回复信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{lyhfids}")
    public AjaxResult remove(@PathVariable Long[] lyhfids)
    {
        return toAjax(lyhfinfoService.deleteLyhfinfoByIds(lyhfids));
    }
}
